import React,{PureComponent} from 'react'
import { Redirect } from 'react-router-dom'
import { connect } from 'react-redux'
//PureComponent必须和immutable结合使用
class Write extends PureComponent{
    //只有和数据相关的组件才会重新渲染
    
    render(){
        const { loginStatus } =this.props;
        console.log(loginStatus)
        if(!loginStatus){
            return <Redirect to='/login' />
            
        }else{
            return (
                <div>写文章</div>
             )
        }   
    }
}
const mapState=(state)=>({
    loginStatus:state.getIn(['login','login'])
})

export default connect(mapState,null)(Write);